<template>
  <a-drawer v-model:visible="visible" title="比赛成绩详情" :width="width >= 580 ? 580 : '100%'" :footer="false">
    <a-descriptions :column="2" size="large" class="general-description">
      <a-descriptions-item label="成绩id">{{ dataDetail?.id }}</a-descriptions-item>
      <a-descriptions-item label="项目报名id">{{ dataDetail?.projectEntryId }}</a-descriptions-item>
      <a-descriptions-item label="比赛结果">{{ dataDetail?.result }}</a-descriptions-item>
      <a-descriptions-item label="成绩">{{ dataDetail?.score }}</a-descriptions-item>
      <a-descriptions-item label="成绩是否有效 0：有效，1：无效">{{ dataDetail?.isEffective }}</a-descriptions-item>
      <a-descriptions-item label="成绩无效原因 若有效则为NULL">{{ dataDetail?.reason }}</a-descriptions-item>
      <a-descriptions-item label="录入时间">{{ dataDetail?.createTime }}</a-descriptions-item>
      <a-descriptions-item label="更新时间">{{ dataDetail?.updateTime }}</a-descriptions-item>
      <a-descriptions-item label="">{{ dataDetail?.createUser }}</a-descriptions-item>
      <a-descriptions-item label="创建人">{{ dataDetail?.createUserString }}</a-descriptions-item>
      <a-descriptions-item label="">{{ dataDetail?.updateUser }}</a-descriptions-item>
      <a-descriptions-item label="修改人">{{ dataDetail?.updateUserString }}</a-descriptions-item>
    </a-descriptions>
  </a-drawer>
</template>

<script lang="ts" setup>
import { useWindowSize } from '@vueuse/core'
import { type ProjectEntryGradeDetailResp, getProjectEntryGrade } from '@/apis'

const { width } = useWindowSize()

const visible = ref(false)
const dataId = ref('')
const dataDetail = ref<ProjectEntryGradeDetailResp>()
// 查询详情
const getDataDetail = async () => {
  const res = await getProjectEntryGrade(dataId.value)
  dataDetail.value = res.data
}

// 打开详情
const onDetail = async (id: string) => {
  dataId.value = id
  await getDataDetail()
  visible.value = true
}

defineExpose({ onDetail })
</script>

<style lang="scss" scoped></style>
